
lst = [1, 10, 11, 13, 17, 20, 29, 39, 44, 66, 98]
# 查找20所在的位置
def find(lst,l,a,x):
    if a >= l:
        mid = int(l + (a - l)/2)
        if lst[mid] == x:
            return mid
        elif lst[mid] > x:
            return find(lst,l ,mid-1 ,x)
        else:
            return find(lst, mid+1 ,a,x)
    else:
        return -1

result = find(lst,0,len(lst)-1,18)
print(result)
